package com.abe.abetest.file;

import android.view.View;
import android.widget.Button;

import com.abe.abetest.R;
import com.abe.libbase.base.BaseActivity;
import com.abe.abetest.utils.CommonUtils;
import com.abe.libcore.utils.helper.ActivityResultHelper;
import com.google.gson.Gson;

import butterknife.BindView;
import butterknife.OnClick;

public class FilePickerActivity extends BaseActivity {

    @BindView(R.id.item_btn)
    Button itemBtn;

    @Override
    public void init() {
        itemBtn.setText("选择文件");
    }

    @OnClick(R.id.item_btn)
    public void picker(View view) {
        ActivityResultHelper.Companion.init(this).startActivityForResult(FilePickerHelper.class, (resultCode, data) -> {
            if (data.getExtras() == null || data.getExtras().getParcelable(FilePickerHelper.filePath) == null)
                return;
            FilePickerHelper.FilePath path = data.getExtras().getParcelable(FilePickerHelper.filePath);
            CommonUtils.wf("path:%s",new Gson().toJson(path));
        });
    }

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_common;
    }
}
